package com.aspose.cells;

import java.util.Iterator;

public class FilterColumnCollection extends CollectionBase {
   private AutoFilter b;

   AutoFilter a() {
      return this.b;
   }

   FilterColumnCollection(AutoFilter m_AutoFilter) {
      this.b = m_AutoFilter;
   }

   public void removeAt(int index) {
      this.a.remove(index);
   }

   public FilterColumn getByIndex(int index) {
      return (FilterColumn)this.a.get(index);
   }

   public FilterColumn get(int fieldIndex) {
      for(int var2 = 0; var2 < this.a.size(); ++var2) {
         FilterColumn var3 = (FilterColumn)this.a.get(var2);
         if (var3.getFieldIndex() == fieldIndex) {
            return var3;
         }

         if (var3.getFieldIndex() > fieldIndex) {
            FilterColumn var4 = new FilterColumn(this, fieldIndex);
            this.a.add(var2, var4);
            return var4;
         }
      }

      FilterColumn var5 = new FilterColumn(this, fieldIndex);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var5);
      return var5;
   }

   FilterColumn a(int var1) {
      for(int var2 = 0; var2 < this.a.size(); ++var2) {
         FilterColumn var3 = (FilterColumn)this.a.get(var2);
         if (var3.getFieldIndex() == var1) {
            return var3;
         }

         if (var3.getFieldIndex() > var1) {
            return null;
         }
      }

      return null;
   }

   int a(FilterColumn var1) {
      if (this.a.size() == 0) {
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
         return 0;
      } else {
         for(int var2 = this.a.size() - 1; var2 >= 0; --var2) {
            FilterColumn var3 = (FilterColumn)this.a.get(var2);
            if (var3.getFieldIndex() == var1.getFieldIndex()) {
               this.a.set(var2, var1);
               return var2;
            }

            if (var3.getFieldIndex() < var1.getFieldIndex()) {
               if (var2 == this.a.size() - 1) {
                  com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
               } else {
                  this.a.add(var2 + 1, var1);
               }

               return var2 + 1;
            }
         }

         this.a.add(0, var1);
         return 0;
      }
   }

   void a(FilterColumnCollection var1) {
      if (var1.a != null && var1.a.size() != 0) {
         Iterator var2 = var1.a.iterator();

         while(var2.hasNext()) {
            FilterColumn var3 = (FilterColumn)var2.next();
            FilterColumn var4 = this.get(var3.getFieldIndex());
            var4.a(var3);
         }
      }

   }
}
